<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta content="telephone=no" name="format-detection" />
    <!-- 留作将来统一添加 -->
    <TEMPLATE>${TEMPLATE}</TEMPLATE>
    <title>模板html</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css">
    <link rel="stylesheet" type="text/css" href="../../css/index.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style type="text/css">
        body {
            /* background: rgba(90, 194, 255, 1); */
            background: #F5F5F5;
        }

        .row {
            margin: 15px;
            padding: 15px;
            background: #fff;
            border-radius: 8px;
        }

        .line {
            height: 1px;
            background-color: rgb(212, 212, 212);
            transform: scaleY(0.5);
        }

        .head {
            padding-bottom: 15px;
        }

        .head-left {
            font-size: 14px;
            font-weight: 400;
            color: #191919;
        }

        .head-right {
            font-size: 12px;
            color: #BFBFBF;
        }

        .flexbox {
            margin-top: 15px;
        }

        .img {
            width: 60px;
            height: 80px;
            min-width: 60px;
            margin-right: 12px;
        }

        .icon {
            width: 28px;
            height: 28px;
            min-width: 28px;
            margin-right: 12px;
        }

        .name {
            color: #191919;
            font-size: 16px;
        }

        .score {
            color: #FD9B43;
            font-size: 14px;
        }

        .buy {
            color: #808080;
            font-size: 12px;
        }
        .buy span {
            color: #191919;
        }
    </style>
</head>

<body>
    <div class="vueApp" v-cloak>
        <div v-if="listData.length > 0">
            <div class="row" v-for="item in listData" @click="handleItem(item)">
                <div>
                    <div class="head" data-flex="main:justify cross:center">
                        <div class="head-left">{{ titleMap[item.type] }}</div>
                        <div class="head-right">{{item.createDate}}</div>
                    </div>
                    <div class="line"></div>
                    <div class="flexbox" :data-flex="item.type == 1 || item.type == 5 ? 'cross:center' : 'cross:top'">
                        <img v-if="item.type == 1 || item.type == 5" :src="item.pic" alt="" class="img">
                        <img v-if="item.type == 8 || item.type == 9 || item.type == 10" :src="item.type == 8 ? '../../image/ui/kjjl.png' : '../../image/ui/kjtc.png'" class="icon" alt="">
                        <div data-flex-box="1">
                            <div class="name" v-if="item.name || item.courseWareName">{{item.name || item.courseWareName}}</div>
                            <div class="score">{{item.operValue}}积分</div>
                            <div class="buy" v-if="item.nickName">购买用户:<span>{{item.nickName}}</span></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div v-else-if="isLoad" class="data-null">
            <p>暂时没有更多数据哦</p>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    // html 的引号一律为双引号(""),js 为单引号('')
    var USER, $S, vm;
    var titleMap = {
        '1': '视频提成',
        '2': '推荐视频获得积分',
        '3': '观看视频',
        '4': '查看学习报告',
        '5': '购买视频',
        '6': '积分充值',
        '7': '推荐商品获得积分',
        '8': '课件奖励',
        '9': '课件提成',
        '10': '购买课件'
    };
    apiready = function () {
        $S = SERVICE();
        USER = USER();
        console.log(JSON.stringify(api.pageParam) + '=====pageParam');
        fnInit();
    };
    // 初始化
    function fnInit() {
        vm = new Vue({
            el: '.vueApp',
            data: {
                pageNo: 1,
                pageSize: 10,
                isLoad: false,
                listData: [],
                titleMap: titleMap
            }
        });
        load();
    }

    function load() {
        getPageData('headerRefreshing');
        fnAddHeaderRefreshingEvent(function () { //设置下拉刷新
            getPageData('headerRefreshing');
        });

        fnAddFooterLoadingEvent(function () { // 设置上拉加载
            getPageData('load');
        });

    }

    // 获取页面数据
    function getPageData(sign) {
        if (sign == 'headerRefreshing') {
            vm.pageNo = 1;
        } else {
            vm.pageNo++;
        }
        var url = 'my/grabIntegralOperDetailList';
        var params = {
            'pageNo': vm.pageNo,
            'pageSize': vm.pageSize
        };
        var callback = function (data) {
            if (vm.pageNo == '1') {
                vm.listData = [];
            }
            for (var i = 0; i < data.listData.length; i++) {
                var item = data.listData[i];
                item.operValue = Number(item.operValue) > 0 ? '+' + item.operValue : item.operValue;
                item.createDate = formatTime(item.createDate, 'order_date');
            }
            api.refreshHeaderLoadDone();
            vm.listData = vm.listData.concat(data.listData);
            vm.isLoad = true;
            // status 为200时,只返回data
        };
        POST(url, params, callback);
    }

    function handleItem(item) {
        return;
        fnOpenPublicWin('视频详情', 'video/detail', {
            isBtn: true,
            btnType: 'img',
            btnName: 'ui/share',
            headerFn: 'headerFn'
        })
    }
</script>

</html>